import React, { useRef, useState, useEffect } from 'react';
export default function Example8() {
    const inputEl = useRef(null)
    const onButtonClick = ()=>{
        inputEl.current.value ='aaa';
        console.log(inputEl)
    }
    const [text,setText] = useState('aabbcc');
    useEffect(() => {
        console.log(text)
    }, [text]);
    return(
        <>
            <input ref={inputEl}  type="text" />
            <button onClick={onButtonClick}>abc</button>
            <br/>
            <br/>
            <input  value={text}  onChange={(e)=>{setText(e.target.value)}}/>
            {text}
        </>
    )
}